import axios from 'axios'

var baseUrl = 'http://localhost:3000'
// 获取轮播图api 
// type:资源类型,对应以下类型,默认为 0 即PC； 1=>安卓； 2=>苹果；3=>ipad
export function getBanners(type) {
  return axios.get(`${baseUrl}/banner?type=${type}`)
}

// 获取首页发现-圆形图标入口列表
export function getBall() {
  return axios.get(`${baseUrl}/homepage/dragon/ball`)
}

// 获取推荐歌单api
export function getReommend(type = 10) {
  return axios.get(`${baseUrl}/personalized?limit=${type}`)
}

// 获取 私人FM api
export function getPrivatefm() {
  return axios.get(`${baseUrl}/personal_fm`)
}
// 获取 榜单内容摘要 api
export function getToplistDetail() {
  return axios.get(`${baseUrl}/toplist/detail`)
}

// 新碟上架api
export function getRecord(limit = 10) {
  return axios.get(`${baseUrl}/top/album?limit=${limit}`)
}

// 获取歌单详情api
export function getPlayList(id) {
  return axios.get(`${baseUrl}/playlist/detail?id=${id}`)
}

// 获取数字专辑api
export function getAlbumList(limit = 10) {
  return axios.get(`${baseUrl}/album/list?limit=${limit}`)
}

// 获取数字专辑榜api
export function getSongsaleboard(type = 0) {
  return axios.get(`${baseUrl}/album/songsaleboard?albumType=${type}`)
}

// 获取数字专辑详情api
export function getAlbumDetail(id) {
  return axios.get(`${baseUrl}/album/detail?id=${id}`)
}

// 获取歌词api
export function getLyric(id) {
  return axios.get(`${baseUrl}/lyric?id=${id}`)
}

// 搜索歌曲api
export function searchMusic(keyword) {
  return axios.get(`${baseUrl}/search?keywords=${keyword}`)
}

// 默认搜索api
export function defaultSearch() {
  return axios.get(`${baseUrl}/search/default`)
}

// 手机登录api
export function phoneLogin(phone, password) {
  return axios.get(`${baseUrl}/login/cellphone?phone=${phone}&password=${password}`)
}


// 用户详情api
export function userDetail(uid) {
  return axios.get(`${baseUrl}/user/detail?uid=${uid}`)
}

export default {
  getBanners, getSongsaleboard, getAlbumDetail, getReommend, getPlayList, getLyric, searchMusic, phoneLogin, userDetail, getToplistDetail, getAlbumList
}